package xhwl.insurance.http.api;

import com.google.gson.Gson;

import okhttp3.RequestBody;
import rx.Observable;
import xhwl.insurance.Constant;
import xhwl.insurance.http.ApiService;
import xhwl.retrofitrx.BaseApi;

/**
 * Created by admin on 2017/6/6.
 */

public class GetWeixinPreOrderApi extends BaseApi {
    WeixinPayreq weixinPayreq;

    public GetWeixinPreOrderApi(String ip, String orderid) {
        weixinPayreq = new WeixinPayreq(ip,orderid);
    }

    @Override
    protected Observable getObservable() {
        RequestBody requestBody = RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), new Gson().toJson(weixinPayreq));
        return retrofit.create(ApiService.class).getWeixinpayPreid(requestBody);
    }

    public class WeixinPayreq {
        private String appid;
        private String mchid;
        private String ip;
        private String orderid;

        public WeixinPayreq(String ip, String orderid) {
            this.appid = Constant.APP_ID;
            this.mchid = Constant.MCH_ID;
            this.ip = ip;
            this.orderid = orderid;
        }
    }
}
